package com.daocao.hua.util;

/**
 * @类名:FilterStr
 * @描述:正则表达式过滤数字、字母和中文
 * @Author：MasterDong
 * @date: Created by MasterDong on 2016/11/17.
 */
public class FilterStr
{
    /**
     *
     * @Title : filterNumber
     * @Type : FilterStr
     * @date : Created by MasterDong on 2016/11/17.
     * @Description : 过滤出数字
     * @return
     */
    public static String filterNumber(String number)
    {
        number = number.replaceAll("[^(0-9)]", "");
        return number;
    }

    /**
     *
     * @Title : filterAlphabet
     * @Type : FilterStr
     * @date : Created by MasterDong on 2016/11/17.
     * @Description : 过滤出字母
     * @param alph
     * @return
     */
    public static String filterAlphabet(String alph)
    {
        alph = alph.replaceAll("[^(A-Za-z)]", "");
        return alph;
    }

    /**
     *
     * @Title : filterChinese
     * @Type : FilterStr
     * @date : Created by MasterDong on 2016/11/17.
     * @Description : 过滤出中文
     * @param chin
     * @return
     */
    public static String filterChinese(String chin)
    {
        chin = chin.replaceAll("[^(\\u4e00-\\u9fa5)]", "");
        return chin;
    }

    /**
     *
     * @Title : filter
     * @Type : FilterStr
     * @date : Created by MasterDong on 2016/11/17.
     * @Description : 过滤出字母、数字和中文
     * @param character
     * @return
     */
    public static String filter(String character)
    {
        character = character.replaceAll("[^(a-zA-Z0-9\\u4e00-\\u9fa5)]", "");
        return character;
    }


}